package com.bjpowernode.security02authorize.controller;

import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SysController {

    //用户访问该地址的时候需要有sys:save权限
    @PreAuthorize("hasAuthority('sys:save')")
    @GetMapping("save")
    public String save() {
        return "保存成功";
    }


    @PreAuthorize("hasAuthority('sys:select')")
    @GetMapping("select")
    public String select() {
        return "查询成功";
    }
}
